package cc.uncarbon.module.custom.model.response;

import cc.uncarbon.framework.core.constant.HelioConstant;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import cc.uncarbon.framework.core.enums.YesOrNoEnum;
import cc.uncarbon.framework.core.enums.EnabledStatusEnum;


/**
 * 优惠券信息 BO
 */
@Accessors(chain = true)
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@Data
public class CouponBO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;


    @Schema(description = "主键ID", hidden = true, title = "仅更新时使用")
    private Long id;

    @Schema(description = "优惠券名称")
    private String name;

    @Schema(description = "优惠券类型：0=代金券、1=折扣券、2=满减券")
    private Integer type;

    @Schema(description = "每人可领取的数量限制")
    private Integer limitPerPerson;

    @Schema(description = "优惠金额（分），对于代金券和满减券表示减免金额，对于折扣券可表示折扣比例的分母（如80表示8折）")
    private Integer amount;

    @Schema(description = "满减券使用时需要满足的最低消费金额（分）, 对于代金券和折扣券此字段可设为0")
    private Integer minSpend;

    @Schema(description = "优惠券总发行数量")
    private Integer totalQuantity;

    @Schema(description = "已使用的优惠券数量")
    private Integer usedQuantity;

    @Schema(description = "优惠券生效开始时间")
    private LocalDateTime startTime;

    @Schema(description = "优惠券失效结束时间")
    private LocalDateTime endTime;

    @Schema(description = "优惠券状态：0=禁用，1=启用")
    private EnabledStatusEnum status;

    @Schema(description = "所属店铺ID")
    private Integer storeId;

    @Schema(description = "创建时间")
    @DateTimeFormat(pattern = HelioConstant.Jackson.DATE_TIME_FORMAT)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = HelioConstant.Jackson.DATE_TIME_FORMAT)
    private LocalDateTime createdAt;

    @Schema(description = "更新时间")
    @DateTimeFormat(pattern = HelioConstant.Jackson.DATE_TIME_FORMAT)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = HelioConstant.Jackson.DATE_TIME_FORMAT)
    private LocalDateTime updatedAt;

}
